<?php
class service_m extends CI_Model{
	function __construct(){
		parent :: __construct();
		$this->load->database();
	}
	
	//--check if have record in db--//
	function check_exist_record(){
		$query = 
				$this->db->select()
						 ->from("service")
						 ->order_by("id", "ASC")
						 ->limit(1)
						 ->get();
		if($query->num_rows()>0){
			return $query;
		}else{
			return false;
		}
						
	}
	
	//--add content to db--//
	function add_service_content($data){
		$query = 
			$this->db->insert("service", $data);
		
		return $query;
	}
	
	//--load service content--//
	function load_service_content($id){
		$query=
			$this->db->select()
					 ->from("service")
					 ->where("id", $id)
					 ->order_by("id", "ASC")
					 ->limit(1)
					 ->get();
		if($query->num_rows()>0){
			return $query;
		}else{
			return FALSE;
		}
	}
	
	//--edit service information--//
	function edit_service_content($id, $data){
		$query = $this->db->update("service", $data, array("id"=>$id));
		return $query;
	}

}